﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PDX.Services
{
    /// <summary>
    /// A service locator
    /// </summary>
    public interface IServiceProvider
    {
        /// <summary>
        /// Resolves an instance of type T.
        /// </summary>
        /// <typeparam name="T">the type of instance to resolve</typeparam>
        /// <returns></returns>
        T Resolve<T>() where T : class;

        /// <summary>
        /// Resolves all instances of type T
        /// </summary>
        /// <typeparam name="T">the type of instances to resolve</typeparam>
        /// <returns></returns>
        IEnumerable<T> ResolveAll<T>() where T : class;

        /// <summary>
        /// Registers the specified factory.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="factory">The factory.</param>
        void Register<T>(Func<T> factory) where T : class;
    }
}
